const { queryDBPromise } = require('./util/db')
/**
 * 添加用户
 */
const testAddUser = () => {
	const sql = "INSERT INTO users (username,password,age)VALUES('root','123',19)"
	queryDBPromise(sql)
		.then(data => {
			console.log('data >> :', data)
			console.log('添加用户成功')
		})
		.catch(err => {
			console.log('添加用户出错', err)
		})
}

/**
 * 查看所有用户
 */
const testFindUserAll = () => {
	const sql = 'SELECT id,username,password,age FROM users'
	queryDBPromise(sql)
		.then(data => {
			console.log('data :', data) // 返回的查询用户数组
		})
		.catch(err => console.log(err))
}
testFindUserAll()

